package com.quick.develop.business.controller;

import com.quick.develop.business.enums.BusinessEnums;
import com.quick.develop.business.service.BusinessService;
import com.quick.develop.business.vo.BusinessEnumVO;
import com.quick.develop.business.vo.BusinessProcessVO;
import com.quick.develop.framework.common.page.R;
import com.quick.develop.framework.common.utils.Result;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 业务控制器
 */
@RequestMapping(value = "business")
@RestController
@AllArgsConstructor
public class BusinessController {

    private final BusinessService businessService;

    /**
     * 获取业务枚举
     *
     * @return 返回业务枚举
     */
    @GetMapping(value = "enum")
    public Result<List<BusinessEnumVO>> getBusinessEnums() {
        return Result.ok(BusinessEnums.getBusinessEnumsList());
    }

    @PostMapping(value = "submit/task")
    public Result<?> submitTask(@RequestBody BusinessProcessVO businessProcessVO) {
        businessService.handle(businessProcessVO);
        return Result.ok();
    }
}
